# put "prod" target first so that docker (without buildx) doesn't compile unneeded targets

FROM tiangolo/uvicorn-gunicorn:python3.11-slim as prod
ENV PORT 5000
ENV LOG_LEVEL debug

COPY requirements.txt pyproject.toml main.py /app/
RUN pip install --no-cache -r /app/requirements.txt
# gunicorn image wants code in /app or /app/app
COPY src /app/src/
RUN pip install -e /app
# GRACEFUL_TIMEOUT

FROM python:3.11-slim as py
RUN mkdir app
WORKDIR /app

ENV PATH="${PATH}:/root/.local/bin"
# not sure I need PYTHONPATH...
ENV PYTHONPATH=.
ENV PYTHONUNBUFFERED=1
RUN pip install --no-cache --upgrade pip mypy types-PyYAML types-aiofiles

FROM py as dev
COPY requirements.txt pyproject.toml main.py /app/
RUN pip install --no-cache -r requirements.txt
COPY src /app/src/
RUN pip install -e .


# FROM base as prod
# RUN pip install --no-cache gunicorn
# COPY src src
